package com.ruoyi.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.domain.ForumPost;
import com.ruoyi.mapper.ForumPostMapper;
import com.ruoyi.service.IForumPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 论坛Service业务层处理
 * 
 * @author lsx
 * @date 2025-01-07
 */
@Service
public class ForumPostServiceImpl implements IForumPostService 
{
    @Autowired
    private ForumPostMapper forumPostMapper;

    /**
     * 查询论坛
     * 
     * @param id 论坛主键
     * @return 论坛
     */
    @Override
    public ForumPost selectForumPostById(Integer id)
    {
        return forumPostMapper.selectForumPostById(id);
    }

    /**
     * 查询论坛列表
     * 
     * @param forumPost 论坛
     * @return 论坛
     */
    @Override
    public List<ForumPost> selectForumPostList(ForumPost forumPost)
    {
        return forumPostMapper.selectForumPostList(forumPost);
    }

    /**
     * 新增论坛
     * 
     * @param forumPost 论坛
     * @return 结果
     */
    @Override
    public int insertForumPost(ForumPost forumPost)
    {
        forumPost.setCreateTime(DateUtils.getNowDate());
        return forumPostMapper.insertForumPost(forumPost);
    }

    /**
     * 修改论坛
     * 
     * @param forumPost 论坛
     * @return 结果
     */
    @Override
    public int updateForumPost(ForumPost forumPost)
    {
        return forumPostMapper.updateForumPost(forumPost);
    }

    /**
     * 批量删除论坛
     * 
     * @param ids 需要删除的论坛主键
     * @return 结果
     */
    @Override
    public int deleteForumPostByIds(Integer[] ids)
    {
        return forumPostMapper.deleteForumPostByIds(ids);
    }

    /**
     * 删除论坛信息
     * 
     * @param id 论坛主键
     * @return 结果
     */
    @Override
    public int deleteForumPostById(Integer id)
    {
        return forumPostMapper.deleteForumPostById(id);
    }
}
